module decoder(S,R,Q,as,a16,a17,LDS,UDS,UFRCS,LFRCS,USRCS,LSRCS);

input as,a16,a17,LDS,UDS;
output UFRCS,LFRCS,USRCS,LSRCS;

input [6:0]R;
input [6:0]S;
output [6:0]Q;

assign Q = ~(S&(~(Q&R)));

assign UFRCS = as|UDS|a16|a17; 	//Upper Flash Memory
assign LFRCS = as|LDS|a16|a17;	//Lower Flash Memory
assign USRCS = as|UDS|~a16|a17;	//Upper SRAM Memory
assign LSRCS = as|LDS|~a16|a17;	//Lower SRAM Memory

endmodule